﻿using System.Linq;
using System.Threading.Tasks;
using Sino.CarGoCome.Core;
using Sino.CarGoCome.Model;
using Sino.CapacityCloud.WebApi;
using System;

namespace Sino.CarGoCome.VirtualCoreData
{
    public class MockLineService : ILineService
    {
        public async Task<LineListResponse> GetFocusLinesAsync()
        {
            return new LineListResponse {Lines = VirtualData.VirtualData.Orders.Select(o => o.Line).Take(5).ToArray()};
        }

        public async Task<LineInfoResponse> AddFocusLineAsync(string startingPlaceCode, string destinationCode)
        {
            return new LineInfoResponse
            {
                Line = new Line { StartingPlaceCode = startingPlaceCode, DestinationCode = destinationCode }
            };
        }

        public async Task<VoidResponse> DeleteFocusLineAsync(string lineId)
        {
            return new VoidResponse();
        }

        public async Task<LineListResponse> GetCommonLinesAsync()
        {
            return new LineListResponse
            {
                Lines = VirtualData.VirtualData.Orders.Select(o => o.Line).Reverse().Take(5).ToArray()
            };
        }


        public async Task<LineInfoResponse> AddCommonLineAsync(string startingPlaceCode, string destinationCode)
        {
            return new LineInfoResponse
            {
                Line = new Line { StartingPlaceCode = startingPlaceCode, DestinationCode = destinationCode }
            };
        }

        public async Task<VoidResponse> DeleteCommonLineAsync(string lineId)
        {
            return new VoidResponse();
        }

    }
}